using UnityEngine;
using System.Collections;

public class StateZombieRun : State<ZombieControl> 
{
    static StateZombieRun m_instance = new StateZombieRun();
    public static StateZombieRun instance { get { return m_instance; } }

    public override void OnEnter(ZombieControl behaviour)
    {
		if (! behaviour.animation.IsPlaying("Atacar2")) {
			foreach (AnimationState state in behaviour.animation) {
        		state.speed = 1F;
    		}
			behaviour.animation.Play("injured_walk_3");
			behaviour.ComprobarDestino();
		}
        //behaviour.destino = behaviour.destinos[behaviour.contador];
    }

    public override void OnUpdate(ZombieControl behaviour)
    {
        if (! behaviour.animation.IsPlaying("Atacar2")) {
			foreach (AnimationState state in behaviour.animation) {
	        	state.speed = 1F;
	    	}
			behaviour.animation.Play("injured_walk_3");
		}
		if (behaviour.animation.IsPlaying("injured_walk_3")) {
			foreach (AnimationState state in behaviour.animation) {
	        	state.speed = 1F;
	    	}
	        behaviour.controller.destination = behaviour.destino;
	        behaviour.ComprobarDestino();
		}
    }

    public override void OnExit(ZombieControl behaviour)
    {
        behaviour.controller.ResetPath();
    }

    public override void OnAction(string name, ZombieControl behaviour, object value)
    {
        
    }

   

}
